package com.bawei.a2010douyin.db.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.bawei.a2010douyin.entity.User;
import com.bawei.a2010douyin.week3.entity.Video;

import com.bawei.a2010douyin.db.dao.UserDao;
import com.bawei.a2010douyin.db.dao.VideoDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig userDaoConfig;
    private final DaoConfig videoDaoConfig;

    private final UserDao userDao;
    private final VideoDao videoDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        videoDaoConfig = daoConfigMap.get(VideoDao.class).clone();
        videoDaoConfig.initIdentityScope(type);

        userDao = new UserDao(userDaoConfig, this);
        videoDao = new VideoDao(videoDaoConfig, this);

        registerDao(User.class, userDao);
        registerDao(Video.class, videoDao);
    }
    
    public void clear() {
        userDaoConfig.clearIdentityScope();
        videoDaoConfig.clearIdentityScope();
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public VideoDao getVideoDao() {
        return videoDao;
    }

}
